import java.util.Scanner;

class Person{
    String name;
    int age;
    boolean gender;

    Person(){
        this.name = "default";
        this.gender = true;
        this.age = 1;
    }
    Person(String n,int a,boolean g){
        this.name = n;
        this.age = a;
        this.gender = g;
    }
    @Override
    public String toString() {
        return name + "-" + Integer.toString(age) + "-" + Boolean.toString(gender);
    }
    @Override
    public boolean equals(Object obj) {
        Person one = (Person) obj;
        if(this.name == one.name && this.age == one.age && this.gender == one.gender){
            return true;
        }
        return false;
    }
}

public class Main {
    public static void main(String args[]){
        Scanner reader = new Scanner(System.in);
        int n1, n2, flag;
        String tmpName;
        int tmpAge;
        boolean tmpGender;
        Person tmPerson;
        n1 = reader.nextInt();
        Person persons1[] = new Person[n1];
        for(int i=0; i<n1; i++){
            persons1[i] = new Person();
        }
        n2 = reader.nextInt();
        Person persons2[] = new Person[n2];
        flag = 0;
        for(int i=0; i<n2; i++){
            tmpName = reader.nextLine();
            tmpAge = reader.nextInt();
            tmpGender = reader.nextBoolean();
            tmPerson = new Person(tmpName, tmpAge, tmpGender);
            if(tmPerson.equals(persons1[0])){
                continue;
            }
            for(int j=0; j<i; j++){
                if(tmPerson.equals(persons2[j])){
                    continue;
                }
            }
            persons2[flag] = tmPerson;
            flag++;
        }
        for(int i=0)
    }
}
